<?php
/**
 * Singleton class
 *
 */
require_once('KLogger.class.php');
final class mysqldb
{
    /**
     * Call this method to get singleton
     *
     * @return mysqldb
     */
    private $conn;
    public static function Instance()
    {
        static $inst = null;
        if ($inst === null) {
            $inst = new mysqldb();
        }
        return $inst;
    }

    /**
     * Private ctor so nobody else can instance it
     *
     */
    private function __construct()
    {
        $host="localhost";
        $user="root";
        $password="";
        $database="door_market";
        $port="3306";
        $this->conn = mysqli_connect($host,$user,$password,$database,$port);
    }
    public function log(){

    }
    public function query($sql){


        $query = mysqli_query($this->conn ,$sql);
        if (!$query) {

            $log = new KLogger ("../logs/log.txt" , KLogger::DEBUG );

            $log->LogError("An exception was thrown in ThisFunction()");

            $log->LogInfo("Internal Query Time:  milliseconds");

            $log->LogDebug("User Count:");
            die(' Неверный запрос: ' . mysql_error());
        }
    }
}